﻿using CDCW.API;
using CGSB.AppCode;
using CDCW.Data;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CGSB.View.Comon
{

    public partial class DownLoadFile : Page
    {
        public int FileID
        {
            get { return int.Parse(Request.QueryString["FileID"] ?? "0"); }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (FileID != 0)
            {
                try
                {
                    JH_Auth_FormAttchg attch = new JH_Auth_FormAttchg();
                    attch = new JH_Auth_FormAttchgB().GetEntity(d => d.ID == FileID);
                    Response.ContentType = "application/x-zip-compressed";
                    Response.AddHeader("Content-Disposition", "attachment;filename=" + attch.FileOldName);
                    string filename = Server.MapPath("/" + attch.FileUrl);
                    Response.TransmitFile(filename);
                }
                catch (Exception)
                {
                    
                    
                }
              
            }

        }
    }
}